﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using CommunitySystem.KaoHeService;

namespace CommunitySystem.PageView
{
    public partial class SH_SYQMKHWindow : ChildWindow
    {
        private KaoHeServiceClient kaoheclient = new KaoHeServiceClient();
        private string _ids { get; set; }
        private string _zt { get; set; }
        public SH_SYQMKHWindow(string ids,string zt)
        {
            InitializeComponent();

            _ids = ids;
            _zt = zt;

        }

        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            //this.DialogResult = true;
            if (_zt == "已退回" && string.IsNullOrEmpty(this.tbSHYY.Text))
            {
                SilverlightMessageBoxLibrary.Message.InfoMessage("请填写退回的原因!");
                return;
            }
            kaoheclient.SYQMKH_SHCompleted += new EventHandler<SYQMKH_SHCompletedEventArgs>(kaoheclient_SYQMKH_SHCompleted);

            kaoheclient.SYQMKH_SHAsync(_ids, this.tbSHYY.Text, _zt);
        }

        void kaoheclient_SYQMKH_SHCompleted(object sender, SYQMKH_SHCompletedEventArgs e)
        {
            if (e.Result)
                SilverlightMessageBoxLibrary.Message.InfoMessage(_zt == "已退回" ? "退回成功！" : "审核成功！");
            else
                SilverlightMessageBoxLibrary.Message.InfoMessage(_zt == "已退回" ? "退回失败！" : "审核失败！");

            this.DialogResult = true;
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
        }
    }
}

